package com.yunxi.estate.config.web;

import com.yunxi.estate.config.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 路由放行拦截配置
 *
 * @author 松子鱼
 */
@Configuration
public class MyWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns(
                /* 路由 */
                "/",
                "/login",
                "/register",
                "/index",
                "/logout",
                "/doLogin",
                "/captcha",
                /* 静态资源 */
                "/assets/**",
                "/js/**",
                "/plugins/**",
                "/favicon.ico"
        );
    }
}
